import { StackNavigator } from 'react-navigation';
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import codePush from 'react-native-code-push';
import store from './store';
import './utils';
import routeConfig from './routeConfig';

// import './core/Storage';


const RouterView = StackNavigator(routeConfig);

class App extends Component {
  componentWillMount() {
    codePush.sync({
      updateDialog: false, // 不向用户弹出更新提示
      installMode: codePush.InstallMode.IMMEDIATE // 安装模式为立即安装
    });
  }

  render() {
    return (
      <Provider store={store}>
        <RouterView />
      </Provider>
    );
  }
}
// 在组建被注册前， 定义热更新参数，声明组建为热更新组建
const codePushOptions = {
  checkFrequency: codePush.CheckFrequency.MANUAL
};
export default codePush(codePushOptions)(App);
